{% load scheduletags %}
<div>
  {% if day.has_occurrences %}
      {% for o in day.get_occurrence_partials %}
              <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#occurrenceModal">

                  <div class="starttime">
                      {% if o.class == 0 %}{{ o.occurrence.start|time:"G:i" }}{% endif %}
                      {% if o.class == 1 %}{{ o.occurrence.start|time:"G:i" }}{% endif %}
                      {% if o.class == 2 %}(All day){% endif %}
                      {% if o.class == 3 %}Ends at {{ o.occurrence.end|time:"G:i" }}{% endif %}
                  </div>
                  <div class="eventdesc">
                      {% title o.occurrence %}
                  </div>
              </div>
              <div class="modal fade" id="occurrenceModal" tabindex="-1" role="dialog" aria-labelledby="occurrence_detailsl">
                <div class="modal-dialog" role="document">
                  <div class="modal-content">
                    <div class="modal-header">
                      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">{{ occurrence.title }}</h4>
                    </div>
                    <div class="modal-body">
                      {% include 'schedule/_detail.html' with occurrence=o.occurrence %}
                    </div>
                   <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                  </div>
                </div>
              </div>
      {% endfor %}
  {% endif %}
</div>
